﻿using System;
using System.IO;
using System.Text;
using YJKGridTopologyCal.Utilities;

namespace YJKGridTopologyCal.IO
{
	public class BEBinaryReader : BinaryReader
	{
		public BEBinaryReader(Stream stream) : base(stream)
		{
		}

		public BEBinaryReader(Stream input, Encoding encoding) : base(input, encoding)
		{
		}

		public override short ReadInt16()
		{
			return BitTweaks.ReverseByteOrder(base.ReadInt16());
		}

		[CLSCompliant(false)]
		public override ushort ReadUInt16()
		{
			return BitTweaks.ReverseByteOrder(base.ReadUInt16());
		}

		public override int ReadInt32()
		{
			return BitTweaks.ReverseByteOrder(base.ReadInt32());
		}

		[CLSCompliant(false)]
		public override uint ReadUInt32()
		{
			return BitTweaks.ReverseByteOrder(base.ReadUInt32());
		}

		public override long ReadInt64()
		{
			return BitTweaks.ReverseByteOrder(base.ReadInt64());
		}

		[CLSCompliant(false)]
		public override ulong ReadUInt64()
		{
			return BitTweaks.ReverseByteOrder(base.ReadUInt64());
		}

		public override float ReadSingle()
		{
			return BitTweaks.ReverseByteOrder(base.ReadSingle());
		}

		public override double ReadDouble()
		{
			return BitTweaks.ReverseByteOrder(base.ReadDouble());
		}

		[Obsolete("Not implemented")]
		public override string ReadString()
		{
			throw new NotImplementedException();
		}

		[Obsolete("Not implemented")]
		public override decimal ReadDecimal()
		{
			throw new NotImplementedException();
		}
	}
}
